package cn.iocoder.yudao.module.nmkj.dal.mysql.video;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.nmkj.dal.dataobject.video.VideoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.nmkj.controller.admin.video.vo.*;

/**
 * 展示视频 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface VideoMapper extends BaseMapperX<VideoDO> {

    default PageResult<VideoDO> selectPage(VideoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VideoDO>()
                .eqIfPresent(VideoDO::getTitle, reqVO.getTitle())
                .eqIfPresent(VideoDO::getVideo, reqVO.getVideo())
                .eqIfPresent(VideoDO::getSort, reqVO.getSort())
                .eqIfPresent(VideoDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(VideoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(VideoDO::getStatus)
                .orderByDesc(VideoDO::getSort));
    }

}